﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace View
{
    public partial class SingleFrm : Form
    {
        public SingleFrm()
        {
            InitializeComponent();
        }

        #region 增删改查

        private void btnAdd_Click(object sender, EventArgs e)
        {
            switch (tabMain.SelectedIndex)
            {
                case 0:
                    break;
                case 1:
                    break;
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;
            }
        }

        private void btnDel_Click(object sender, EventArgs e)
        {
            switch (tabMain.SelectedIndex)
            {
                case 0:
                    break;
                case 1:
                    break;
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;
            }
        }

        private void btnAlter_Click(object sender, EventArgs e)
        {
            switch (tabMain.SelectedIndex)
            {
                case 0:
                    break;
                case 1:
                    break;
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;
            }
        }

        private void btnSelect_Click(object sender, EventArgs e)
        {
            switch (tabMain.SelectedIndex)
            {
                case 0:
                    StringBuilder sbSQL1 = new StringBuilder();
                    sbSQL1.Append("SELECT GUID,CONNECTIONSTRING FROM DATASOURCE WHERE ISDELETE = 0");
                    dataGridView1.DataSource = BLL.MyOracleHelper.ExecuteTable(BLL.Control.getConn(), sbSQL1.ToString());
                    break;
                case 1:
                    StringBuilder sbSQL2 = new StringBuilder();
                    sbSQL2.Append("SELECT U.GUID, U.IP, U.LICENCE, U.DESCRIPTION, U.CREATETIME,");
                    sbSQL2.Append("U.MODIFYTIME, U.ISDELETE FROM GWY.USERIP U");
                    dataGridView2.DataSource = BLL.MyOracleHelper.ExecuteTable(BLL.Control.getConn(), sbSQL2.ToString());
                    break;
                case 2:
                    break;
                case 3:
                    StringBuilder sbSQL4=new StringBuilder();
                    sbSQL4.Append("select C.GUID,C.ITEMID,C.NAME,C.COMMANDTEXT,C.DESCRIPTION,C.CREATETIME,C.MODIFYTIME,");
                    sbSQL4.Append("B.CONNECTIONSTRING from COMMAND C,DATASOURCE B where ");
                    sbSQL4.Append("C.DATASOURCE_GUID=B.GUID and B.ISDELETE=0 AND C.ISDELETE=0");
                    dataGridView4.DataSource = BLL.MyOracleHelper.ExecuteTable(BLL.Control.getConn(),sbSQL4.ToString());
                    break;
                case 4:
                    break;
            }
        }

        #endregion

        private void tabMain_SelectedIndexChanged(object sender, EventArgs e)
        {
            btnSelect_Click(null, null);
        }

        private void SingleFrm_Load(object sender, EventArgs e)
        {
            btnSelect_Click(null, null);
        }
    }
}
